import java.util.InputMismatchException;
import java.util.Scanner;

public class TestFinally {

    public static void func(int a) {
        /*try {
            System.out.println(10/a);
        }catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("a == 0");
        }*/
        System.out.println(10/a);
    }

    public static void main(String[] args) {


        try {
            func(0);
        }catch (ArithmeticException e) {
            //e.printStackTrace();
            System.out.println("a == 0");
        }
    }



    public static int getData(){
        Scanner sc = null;
        try{
            sc = new Scanner(System.in);
            return 10;
        }catch (InputMismatchException e){
            e.printStackTrace();
        }finally {
            sc.close();
            //System.out.println("finally中代码");
            return 1000;
        }
        //System.out.println("try-catch-finally之后代码");
        /*if(null != sc){
            sc.close();
        }*/
        //return 0;
    }

    public static void main1(String[] args) {
        int data = getData();
        System.out.println(data);
    }
}